#ifndef BROADTHREAD_H
#define BROADTHREAD_H

#include <QObject>
#include <QThread>

#include <QtNetwork/QUdpSocket>
#include <QHostAddress>
class BroadThread : public QThread
{
    Q_OBJECT
public:
    explicit BroadThread(QObject *parent = nullptr);
    ~BroadThread();

    void setPort(quint16 port);
    quint16 getPort() const;

signals:
    void datagramReceived(const QByteArray &data, const QHostAddress &address);

protected:
    void run() override;

private:
    QUdpSocket *m_udpSocket;
    quint16 m_port;
    bool m_running;
};

#endif // BROADTHREAD_H
